package hzjbbis.commons.maintenance.action;

import hzjbbis.commons.maintenance.dao.SingleTableDao;
import hzjbbis.commons.maintenance.handler.TempletStandard;
import hzjbbis.commons.maintenance.handler.request.SaveRequestHandler;
import hzjbbis.framework.tree.TreeNode;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 * @version 	1.0
 * @author
 */
public class UpdateNodeAction extends Action {

	public ActionForward execute(
		ActionMapping mapping,
		ActionForm form,
		HttpServletRequest request,
		HttpServletResponse response)
		throws Exception {
		SaveRequestHandler requestHandler = new SaveRequestHandler(request, TempletStandard.UPDATE_NODE_KEY_HANDLER);

		SingleTableDao.executeHandler(requestHandler);

		TreeNode treeNode = requestHandler.getTreeNode();

		request.setAttribute("xml", treeNode.toString());
		return mapping.findForward("submitSuccess");
	}

}
